﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QLNS_v1.Bus
{
   public class OptionBH_Bus
    {
        NhanVienContextDataContext nhanvien = new NhanVienContextDataContext();
        public List<OptionBH> ListBH()
        {
            var obh = from bh in nhanvien.OptionBHs select bh;
            return obh.ToList<OptionBH>();
        }
        public bool Update(OptionBH bh)
        {
            try
            {
                var query = nhanvien.OptionBHs.Single(p => p.id == bh.id);
                query.BHTN = bh.BHTN;
                query.BHXH = bh.BHXH;
                query.BHYT = bh.BHYT;
                query.id = bh.id;
                nhanvien.SubmitChanges();
                return true;
            }
            catch
            {
                return false;
            }
        }
    }
}
